//
//  HWGroupChatRecommendProtocol.swift
//  HWanGame
//
//  Created by 王昌健 on 2022/10/25.
//  Copyright © 2022 94Wan. All rights reserved.
//

import UIKit

class HWGroupChatRecommendProtocol: NSObject {
    var models:[HWGroupChatRecommendModel]?
    var joinButtonClick:((_:HWGroupChatRecommendModel)->())?
}

extension HWGroupChatRecommendProtocol: UITableViewDelegate, UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return models?.count ?? 0
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = HWGroupChatRecommendCell.cellWithTableView(tableView)
        cell.model = models?[indexPath.row]
        cell.joinButtonClick = {
            self.joinButtonClick?($0)
        }
        return cell
    }
    
}
